/*
 * --------------------------------------------------------------
 * Copyright ©  2015 Hangzhou DtDream Technologies Co.,Ltd.
 * --------------------------------------------------------------
 *      Product: 协同数治
 *  Module Name: design
 * Date Created: 2022/12/16
 *  Description: TODO
 * --------------------------------------------------------------
 * Modification History
 * DATE            NAME            Description
 * --------------------------------------------------------------
 * 2022/12/16       yewj            TODO
 * --------------------------------------------------------------
 */

package com.dtdream.pattern.single.type7;

/**
 * 枚举的方式
 *
 * @Author: yewj
 **/
public class SingleSeven {
    public static void main(String[] args) {
        Singleton instanceOne = Singleton.INSTANCE;
        Singleton instanceTwo = Singleton.INSTANCE;
        System.out.println(instanceOne);
        System.out.println(instanceTwo);
        System.out.println(instanceOne == instanceTwo);
        instanceOne.syaOk();
        instanceTwo.syaOk();
    }
}

enum Singleton {
    INSTANCE;
    public void syaOk() {
        System.out.println("ok");
    }
}
